package edu.yourl.web;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

public abstract class ButtonBar extends Panel {

	private static final long serialVersionUID = 1L;

	@SuppressWarnings("serial")
	public ButtonBar(String id) {
		super(id);
		Link<Void> link = new Link<Void>("home") {

			@Override
			public void onClick() {
				setResponsePage(this.getApplication().getHomePage());
			}
		};
		add(link);

		Label currentUser = new Label("currentUser", getCurrentUser());
		link.add(currentUser);

		Link<Void> logoutLink = new Link<Void>("logout") {

			@Override
			public void onClick() {
				ButtonBar.this.removeUserInfo();
			}
		};

		add(logoutLink);
		
		Link<Void> profileLink = new Link<Void>("profile") {
			@Override
			public void onClick() {
				setResponsePage(ProfilePage.class);
			}
		};
		add(profileLink);

	}

	protected abstract void removeUserInfo();

	protected abstract String getCurrentUser();

}
